import {createApp} from 'vue'

import 'normalize.css/normalize.css' // a modern alternative to CSS resets

import ElementPlus from 'element-plus'
import locale from 'element-plus/lib/locale/lang/zh-cn'
import './styles/element-variables.scss'

import '@/styles/index.scss' // global css

import App from './App'
import store from './store'
import { router } from './router'

import './icons' // icon
import './permission' // permission control

// 权限指令
import * as directives from '@/directive'

// 数据字典
import dict from '@/mixins/Dict'


const app = createApp(App)

import SvgIcon from '@/components/SvgIcon'// svg component

// register globally
app.component('svg-icon', SvgIcon)

// 全局注册el-icon图标
import * as ElIconModules from '@element-plus/icons-vue'
for(let iconName in ElIconModules){
  app.component(iconName,ElIconModules[iconName])
}

// 自定义指令
Object.keys(directives).forEach(key => {
  app.directive(key, directives[key])
})


app.use(dict)



app.use(ElementPlus, {
  locale
})

app.use(store)
app.use(router)
app.mount('#app')

window.$config = null
